﻿@model BrandedProviderPortal.Models.SupportModel
@{
    if (PayformancePrincipal.Current == null)
    {
        Layout = "~/Views/Shared/_Support.cshtml";
    }

    ViewBag.Title = "{:Support.Title}";
}

<div id="faq-container">
    <div id="faq-header">
        <span id="support-header-faq">{:Support.Header}</span>
        <div style="clear:both;"></div>
        </div>
        
    <div id="faq-content">
        <table width="100%">
            <tr>
                <td class="support-faq-section">
                <div class="right"><span id="support-openall">{:Support.OpenAll}</span><span id="support-closeall">{:Support.CloseAll}</span></div>
                    @foreach (Faq qa in Model.Faqs)
                    {   <div class="faq-set">
                        <dl>
                            <dt id="q-@qa.Id" class="support-question">
                            @Html.Image(imageName:"minimize.png",htmlAttributes: new{ @class="faqmin"}) @Html.Image(imageName:"maximize.png", htmlAttributes: new { @class = "faqmax" }) @Html.Markdown(qa.Question)</dt>
                            <dd id="a-@qa.Id" class="support-answer" style="display:none">@Html.Markdown(qa.Answer)
                                <div style="clear: both; ">
                                </div>
                            </dd>
                        </dl>
                        </div>
                    }
                </td>
                <td class="support-contact-section">
                    <div id="contact-container">
                        @foreach (var sc in Model.SupportContacts)
                        {
                            <div class="contact-set">
                                <ul>                        
                                    <li class="support-header">@sc.SupportContactName</li>
                                   <li> @Html.Image(imageName:"emailicon.png", htmlAttributes: new { @class = "contact-icon" })<a href="mailto:@sc.SupportContactEmail">@sc.SupportContactEmail</a></li>
                                   <li> @Html.Image(imageName:"phoneicon.png", htmlAttributes: new { @class = "contact-icon" })@sc.SupportContactGeneralPhone</li>
                                </ul>
                            </div>
                 }
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <div id="faq-footer">
        <div style="clear: both">
        </div>
    </div>
</div>
<script type="text/javascript">

    $("dt.support-question").click(function () {

        if ($(this).next().is(':hidden')) {
            $('.support-answer').slideUp('fast');
            $('.faqmin').hide();
            $('.faqmax').show();
            $($(this).children("img")).toggle();
            $(this).next().slideToggle('fast');
        }
        else {
            $($(this).children("img")).toggle();
            $(this).next().slideToggle('fast');
        }
    }
    );

    $('#support-openall').click(function () {
        $('.support-answer').show();
        $('.faqmin').show();
        $('.faqmax').hide();
    });

    $('#support-closeall').click(function () {
        $('.support-answer').hide();
        $('.faqmin').hide();
        $('.faqmax').show();
    });

</script>
